package com.lagou.service.impl;

import com.lagou.service.HelloServiceAsync;
import org.apache.dubbo.config.annotation.Service;

import java.util.concurrent.CompletableFuture;

@Service
public class HelloServiceAsyncImpl implements HelloServiceAsync {

    @Override
    public CompletableFuture<String> sayHello(String name) {
        return CompletableFuture.supplyAsync(() -> {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return "Hello " + name + "!";
        });
    }

}
